import numpy as np
import cv2 as cv
 
 
# 双目相机参数
class stereoCamera(object):
    def __init__(self):
        # 左相机内参
        self.cam_matrix_left = np.array([[3289.57273435726,0,986.566770955804],
                                                            [0,3288.42915165856,543.366931618206],
                                                            [0,0,1]])
        # 右相机内参
        self.cam_matrix_right = np.array([[3298.83750911695,0,976.177120977508],
                                                               [0,3289.04370265799,518.013323352439],
                                                                [0,0,1]])
        # 左右相机畸变系数:[k1, k2, p1, p2, k3]
        self.distortion_l = np.array([[-0.0491627088588504,0.0330387029346049,0,0,0]])
        self.distortion_r = np.array([[-0.00751282234175557,-0.25434155588815,0,0,0]])
 
        # 旋转矩阵
        # self.R = np.array([[0.996701070522191,0.012294962953847,-0.080223499711010],
        #                              [0.016434608650973,0.998555905884584,-0.051146910576366],
        #                              [0.079478800056419,0.052296622347729,0.995463803275946]])

        self.R = np.array([[0.999237690703985,-0.00413948024584952,0.0388188379509426],
                                     [0.00380824735809511,0.999955743108361,0.00860285282136336],
                                     [ -0.0388527312891498,-0.00844846304961439,0.999209231714495]])
        # 平移矩阵
        self.T = np.array([[-68.7558862524187], [-0.0379823815856577], [2.40882248980168]])
 
        # 主点列坐标的差
        self.doffs = 0.0
 
        # 指示上述内外参是否为经过立体校正后的结果
        self.isRectified = False
 